(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory();
	else if(typeof define === 'function' && define.amd)
		define([], factory);
	else {
		var a = factory();
		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
	}
})(self, () => {
return /******/ (() => { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ "./src/core/compiler.ts":
/*!******************************!*\
  !*** ./src/core/compiler.ts ***!
  \******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   compileDOMElement: () => (/* binding */ compileDOMElement),
/* harmony export */   compileEUVNode: () => (/* binding */ compileEUVNode),
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */   registerDirective: () => (/* binding */ registerDirective)
/* harmony export */ });
function _array_like_to_array(arr, len) {
    if (len == null || len > arr.length) len = arr.length;
    for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
    return arr2;
}
function _array_with_holes(arr) {
    if (Array.isArray(arr)) return arr;
}
function _array_without_holes(arr) {
    if (Array.isArray(arr)) return _array_like_to_array(arr);
}
function _iterable_to_array(iter) {
    if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _iterable_to_array_limit(arr, i) {
    var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
    if (_i == null) return;
    var _arr = [];
    var _n = true;
    var _d = false;
    var _s, _e;
    try {
        for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
            _arr.push(_s.value);
            if (i && _arr.length === i) break;
        }
    } catch (err) {
        _d = true;
        _e = err;
    } finally{
        try {
            if (!_n && _i["return"] != null) _i["return"]();
        } finally{
            if (_d) throw _e;
        }
    }
    return _arr;
}
function _non_iterable_rest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _non_iterable_spread() {
    throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _sliced_to_array(arr, i) {
    return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
}
function _to_consumable_array(arr) {
    return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
}
function _type_of(obj) {
    "@swc/helpers - typeof";
    return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
}
function _unsupported_iterable_to_array(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _array_like_to_array(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(n);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
}
function _ts_generator(thisArg, body) {
    var f, y, t, g, _ = {
        label: 0,
        sent: function() {
            if (t[0] & 1) throw t[1];
            return t[1];
        },
        trys: [],
        ops: []
    };
    return g = {
        next: verb(0),
        "throw": verb(1),
        "return": verb(2)
    }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
        return this;
    }), g;
    function verb(n) {
        return function(v) {
            return step([
                n,
                v
            ]);
        };
    }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while(_)try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [
                op[0] & 2,
                t.value
            ];
            switch(op[0]){
                case 0:
                case 1:
                    t = op;
                    break;
                case 4:
                    _.label++;
                    return {
                        value: op[1],
                        done: false
                    };
                case 5:
                    _.label++;
                    y = op[1];
                    op = [
                        0
                    ];
                    continue;
                case 7:
                    op = _.ops.pop();
                    _.trys.pop();
                    continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
                        _ = 0;
                        continue;
                    }
                    if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
                        _.label = op[1];
                        break;
                    }
                    if (op[0] === 6 && _.label < t[1]) {
                        _.label = t[1];
                        t = op;
                        break;
                    }
                    if (t && _.label < t[2]) {
                        _.label = t[2];
                        _.ops.push(op);
                        break;
                    }
                    if (t[2]) _.ops.pop();
                    _.trys.pop();
                    continue;
            }
            op = body.call(thisArg, _);
        } catch (e) {
            op = [
                6,
                e
            ];
            y = 0;
        } finally{
            f = t = 0;
        }
        if (op[0] & 5) throw op[1];
        return {
            value: op[0] ? op[1] : void 0,
            done: true
        };
    }
}
function escapeRegExp(str) {
    //$&表示整个被匹配的字符串
    return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function 编译表达式(str) {
    /**
     * 给一任意字符串，获取所有中括号内的值
     * @param { string } str
     */ var 解开中括号 = function(str) {
        // a.b[c.d[0]].e[0].f[g[h[i.j.k]]].l =>
        // ["c.d[0]", "0", "g[h[i.j.k]]"] =>
        // ["c.d", "0", "g", "h[i.j.k]"] =>
        // ["c.d", "0", "g", "h", "i.j.k"]
        var 取括号内值 = function(str) {
            var startPosition = str.indexOf("[");
            if (startPosition === -1) {
                return;
            }
            // 有左括号，无右括号
            var substr = str.substring(startPosition + 1);
            if (!substr.includes("]")) {
                throw new Error('"'.concat(str, '"格式错误，缺少“]”'));
            }
            var 左括号count = 1;
            for(var p = 0; p < substr.length; p++){
                var c = substr[p];
                if (c === '[') {
                    左括号count++;
                } else if (c === ']') {
                    左括号count--;
                }
                if (左括号count === 0) {
                    var 第一个中括号内容 = [
                        substr.substring(0, p)
                    ];
                    var 第一个括号内容的第一个左括号位置 = 第一个中括号内容[0].indexOf("[");
                    if (第一个括号内容的第一个左括号位置 !== -1) {
                        var _第一个中括号内容;
                        var 第一个中括号内容中的第一个括号内容 = 取括号内值(第一个中括号内容[0]);
                        (_第一个中括号内容 = 第一个中括号内容).push.apply(_第一个中括号内容, _to_consumable_array(第一个中括号内容中的第一个括号内容));
                        第一个中括号内容[0] = 第一个中括号内容[0].substring(0, 第一个括号内容的第一个左括号位置);
                    }
                    var 剩余字符 = substr.substring(p + 1);
                    var 剩余括号内值 = 取括号内值(剩余字符);
                    if (!剩余括号内值) {
                        return _to_consumable_array(new Set(第一个中括号内容));
                    }
                    return _to_consumable_array(new Set(第一个中括号内容.concat(剩余括号内值)));
                }
            }
            if (左括号count !== 0) {
                throw new Error('"'.concat(str, '"格式错误，缺少').concat(左括号count, "个“]”"));
            }
        };
        return 取括号内值(str);
    };
    /**
     * 给一个字符串（不包含中括号）
     * @param { string } str
     */ var 获取标识符相关参数 = function(str) {
        if (str.startsWith(".")) {
            throw new Error('"'.concat(str, '"格式错误，不能以“.”开头'));
        }
        var _str_split = _sliced_to_array(str.split("."), 1), key = _str_split[0];
        // 数字
        if (!isNaN(parseFloat(key)) || !isNaN(parseInt(key))) {
            return undefined;
        }
        return key;
    };
    if (!str) {
        return null;
    }
    var args = [];
    var 处理后文本 = str.replace(/\s/g, "");
    var 分割后文本 = 处理后文本.split(/\=|\+|\-|\*|\/|\%|\<|\>|\<|\>|\&|\^|\||\?|\:/g);
    var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
    try {
        for(var _iterator = 分割后文本[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
            var expressionBlock = _step.value;
            // 内容较多的 block
            if (expressionBlock.includes("[")) {
                var 中括号中的值的数组 = 解开中括号(expressionBlock);
                var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
                try {
                    for(var _iterator1 = 中括号中的值的数组[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
                        var 值 = _step1.value;
                        var argName = 获取标识符相关参数(值);
                        if (argName) {
                            args.push(argName);
                        }
                    }
                } catch (err) {
                    _didIteratorError1 = true;
                    _iteratorError1 = err;
                } finally{
                    try {
                        if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
                            _iterator1.return();
                        }
                    } finally{
                        if (_didIteratorError1) {
                            throw _iteratorError1;
                        }
                    }
                }
                // 中括号前面的内容
                var identifier = expressionBlock.substring(0, expressionBlock.indexOf("["));
                var argName1 = 获取标识符相关参数(identifier);
                if (argName1) {
                    args.push(argName1);
                }
                continue;
            }
            // 普通 block
            var argName2 = 获取标识符相关参数(expressionBlock);
            if (argName2) {
                args.push(argName2);
            }
        }
    } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
    } finally{
        try {
            if (!_iteratorNormalCompletion && _iterator.return != null) {
                _iterator.return();
            }
        } finally{
            if (_didIteratorError) {
                throw _iteratorError;
            }
        }
    }
    var f = new Function(args.join(","), "\n        return (".concat(处理后文本, ");\n    "));
    return {
        f: f,
        needArgs: args
    };
}
function runFunction(f, args) {
    if (!f) {
        throw new Error("f为空");
    }
    var result = f.apply(void 0, _to_consumable_array(args));
    return (typeof result === "undefined" ? "undefined" : _type_of(result)) === "object" ? JSON.stringify(result) : result;
}
function runCode(code, argsValue) {
    if (!code) {
        throw new Error("缺少表达式");
    }
    var _编译表达式 = 编译表达式(code), f = _编译表达式.f, needArgs = _编译表达式.needArgs;
    if (!argsValue) {
        if (needArgs) {
            throw new Error("缺少参数");
        }
        return runFunction(f, []);
    }
    return runFunction(f, argsValue(needArgs));
}
function getCodeFromText(textContent) {
    var startIndex, codeEndIndex, text, code, textEndIndex;
    return _ts_generator(this, function(_state) {
        switch(_state.label){
            case 0:
                text = textContent;
                _state.label = 1;
            case 1:
                if (!((startIndex = text.indexOf("{{")) !== -1)) return [
                    3,
                    3
                ];
                codeEndIndex = text.indexOf("}}", startIndex);
                if (codeEndIndex === -1) return [
                    3,
                    3
                ];
                code = text.substring(startIndex + 2, codeEndIndex).trim();
                textEndIndex = codeEndIndex + 2;
                return [
                    4,
                    {
                        beforeCodeText: text.substring(0, startIndex),
                        code: code
                    }
                ];
            case 2:
                _state.sent();
                text = text.substring(textEndIndex);
                return [
                    3,
                    1
                ];
            case 3:
                return [
                    2
                ];
        }
    });
}
var directiveMap = new Map();
function registerDirective(info, directive) {
    if (!info) {
        throw new Error("name must be a string or object");
    }
    if (!info.name) {
        throw new Error("name is ".concat(info.name));
    }
    if (!info.name.startsWith("e-")) {
        info.name = "e-" + info.name;
    }
    directive.getInformation = function() {
        return info;
    };
    directiveMap.set(info.name, directive);
    if (info.aliasName) {
        directiveMap.set(info.aliasName, directive);
    }
}
function compileDOMElement(node) {
    if (node.nodeType === Node.TEXT_NODE) {
        if (!node.textContent || /^\s+$/g.test(node.textContent)) {
            return null;
        }
        return {
            tag: node.nodeName,
            type: node.nodeType,
            props: {},
            text: node.textContent ? node.textContent : "",
            element: node
        };
    }
    var props = {};
    var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
    try {
        for(var _iterator = node.attributes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
            var a = _step.value;
            props[a.name] = a.value;
        }
    } catch (err) {
        _didIteratorError = true;
        _iteratorError = err;
    } finally{
        try {
            if (!_iteratorNormalCompletion && _iterator.return != null) {
                _iterator.return();
            }
        } finally{
            if (_didIteratorError) {
                throw _iteratorError;
            }
        }
    }
    var children = new Array();
    for(var i = 0; i < node.childNodes.length; i++){
        if (node.childNodes[i].nodeType === Node.COMMENT_NODE) {
            continue;
        }
        var child = compileDOMElement(node.childNodes[i]);
        if (child) {
            children.push(child);
        }
    }
    return {
        tag: node.nodeName,
        type: node.nodeType,
        props: props,
        children: children,
        element: node
    };
}
function compileEUVTextNode(node, root, argsValue) {
    if (node.type !== Node.TEXT_NODE) {
        throw new Error("wrong node type");
    }
    if (!node.text) {
        node.render = function() {};
        return;
    }
    if (!node.element) {
        node.element = document.createTextNode(node.text);
    }
    root.appendChild(node.element);
    var gen = getCodeFromText(node.text);
    var result = gen.next();
    if (!argsValue || result.done) {
        node.render = function() {
            node.element.textContent = node.text;
        };
        return;
    }
    node.render = function() {
        var newText = "";
        var gen = getCodeFromText(node.text);
        var result = gen.next();
        for(; !result.done; result = gen.next()){
            var code = result.value;
            var codeResult = runCode(code.code, argsValue);
            newText += code.beforeCodeText + codeResult;
        }
        node.element.textContent = newText;
    };
}
/**
 * 获取 EUVNode 渲染函数（不渲染子节点）
 * @param node
 * @param root
 * @returns
 */ function compileEUVNode(node, root, argsValue) {
    var _loop = function(key) {
        var value = node.props[key];
        var directiveName = "";
        if (key.startsWith(":")) {
            directiveName = ":";
        } else if (key.startsWith("@")) {
            directiveName = "@";
        } else {
            directiveName = key.split(":")[0];
        }
        var directive = directiveMap.get(directiveName);
        if (directive) {
            var info = directive.getInformation();
            if (directive.mounted) {
                var mountedFn = void 0;
                if (info.calculatedValue) {
                    mountedFn = function() {
                        var calculatedValue = runCode(value, argsValue);
                        directive.mounted(node.element, {
                            name: key,
                            value: value,
                            calculatedValue: calculatedValue
                        });
                    };
                } else {
                    mountedFn = function() {
                        directive.mounted(node.element, {
                            name: key,
                            value: value
                        });
                    };
                }
                directiveMountedF.push(mountedFn);
            }
            if (directive.updated) {
                var updateFn = void 0;
                if (info.calculatedValue) {
                    updateFn = function() {
                        var calculatedValue = runCode(value, argsValue);
                        directive.updated(node.element, {
                            name: key,
                            value: value,
                            calculatedValue: calculatedValue
                        }, node);
                    };
                } else {
                    updateFn = function() {
                        directive.updated(node.element, {
                            name: key,
                            value: value
                        }, node);
                    };
                }
                directiveUpdateF.push(updateFn);
            }
        } else {
            try {
                node.element.setAttribute(key, value);
            } catch (e) {}
        }
    };
    // 文本节点
    if (node.type === Node.TEXT_NODE) {
        compileEUVTextNode(node, root, argsValue);
        return;
    }
    // 元素节点
    if (!node.element) {
        node.element = document.createElement(node.tag);
    }
    // compile child node
    if (node.children) {
        var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
        try {
            for(var _iterator = node.children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
                var child = _step.value;
                compileEUVNode(child, node.element, argsValue);
            }
        } catch (err) {
            _didIteratorError = true;
            _iteratorError = err;
        } finally{
            try {
                if (!_iteratorNormalCompletion && _iterator.return != null) {
                    _iterator.return();
                }
            } finally{
                if (_didIteratorError) {
                    throw _iteratorError;
                }
            }
        }
    }
    var directiveMountedF = [];
    var directiveUpdateF = [];
    for(var key in node.props)_loop(key);
    // mounted
    if (node.element === root) {
        return;
    }
    root.appendChild(node.element);
    directiveMountedF.forEach(function(mounted) {
        return mounted();
    });
    node.render = function() {
        directiveUpdateF.forEach(function(update) {
            return update();
        });
    };
}
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
    registerDirective: registerDirective,
    compileDOMElement: compileDOMElement,
    compileEUVNode: compileEUVNode
});


/***/ }),

/***/ "./src/euv.ts":
/*!********************!*\
  !*** ./src/euv.ts ***!
  \********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   EUV: () => (/* binding */ EUV)
/* harmony export */ });
/* harmony import */ var _core_compiler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core/compiler */ "./src/core/compiler.ts");
function _array_like_to_array(arr, len) {
    if (len == null || len > arr.length) len = arr.length;
    for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
    return arr2;
}
function _array_with_holes(arr) {
    if (Array.isArray(arr)) return arr;
}
function _class_call_check(instance, Constructor) {
    if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function");
    }
}
function _defineProperties(target, props) {
    for(var i = 0; i < props.length; i++){
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
    }
}
function _create_class(Constructor, protoProps, staticProps) {
    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
    if (staticProps) _defineProperties(Constructor, staticProps);
    return Constructor;
}
function _define_property(obj, key, value) {
    if (key in obj) {
        Object.defineProperty(obj, key, {
            value: value,
            enumerable: true,
            configurable: true,
            writable: true
        });
    } else {
        obj[key] = value;
    }
    return obj;
}
function _iterable_to_array_limit(arr, i) {
    var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
    if (_i == null) return;
    var _arr = [];
    var _n = true;
    var _d = false;
    var _s, _e;
    try {
        for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
            _arr.push(_s.value);
            if (i && _arr.length === i) break;
        }
    } catch (err) {
        _d = true;
        _e = err;
    } finally{
        try {
            if (!_n && _i["return"] != null) _i["return"]();
        } finally{
            if (_d) throw _e;
        }
    }
    return _arr;
}
function _non_iterable_rest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _sliced_to_array(arr, i) {
    return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
}
function _type_of(obj) {
    "@swc/helpers - typeof";
    return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
}
function _unsupported_iterable_to_array(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _array_like_to_array(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(n);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
}

var activeEffectFunction = null; // using element's render function
var EUV = /*#__PURE__*/ function() {
    "use strict";
    function EUV() {
        var _this = this;
        var option = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
            effectLog: false,
            mounted: function() {},
            data: {},
            watch: {},
            computed: {},
            methods: {},
            directives: {}
        };
        _class_call_check(this, EUV);
        _define_property(this, "init", void 0);
        _define_property(this, "effectLog", void 0);
        _define_property(this, "appNode", void 0);
        _define_property(this, "mountedElement", void 0);
        _define_property(this, "mounted", void 0);
        _define_property(this, "$refs", void 0);
        _define_property(this, "data", void 0);
        _define_property(this, "watch", void 0);
        _define_property(this, "computed", void 0);
        _define_property(this, "methods", void 0);
        _define_property(this, "dataEffectFnMap", void 0 // 数据变化回调
        );
        if (!option.mounted) {
            option.mounted = function() {};
        }
        if (!option.data) {
            option.data = {};
        }
        if (typeof option.mounted === "function") {
            this.mounted = option.mounted;
        } else {
            throw new Error("mounted must be a function");
        }
        var that = this;
        this.init = false;
        this.$refs = {};
        this.effectLog = option.effectLog || false;
        // this.data = {...option.data};
        this.watch = option.watch || {};
        this.computed = option.computed || {};
        this.methods = option.methods || {};
        var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
        try {
            for(var _iterator = Object.keys(this.methods)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
                var methodName = _step.value;
                // 判断是否为函数
                if (typeof this.methods[methodName] !== "function") {
                    throw new Error("methods can only puts function");
                }
                // 绑定 this
                this.methods[methodName] = this.methods[methodName].bind(this);
            }
        } catch (err) {
            _didIteratorError = true;
            _iteratorError = err;
        } finally{
            try {
                if (!_iteratorNormalCompletion && _iterator.return != null) {
                    _iterator.return();
                }
            } finally{
                if (_didIteratorError) {
                    throw _iteratorError;
                }
            }
        }
        this.dataEffectFnMap = new Map(); // 数据变化回调，使用第一层数据的 key 作为键值
        var dataEffectFnMap = this.dataEffectFnMap;
        for(var k in option.data){
            var mappingSet = new Set();
            this.dataEffectFnMap.set(k, mappingSet);
        }
        var track = function(key) {
            if (!activeEffectFunction) {
                return;
            }
            // 为数据绑定相关 render 函数
            var relatedEffectFnSet = dataEffectFnMap.get(key);
            if (relatedEffectFnSet && !relatedEffectFnSet.has(activeEffectFunction)) {
                relatedEffectFnSet.add(activeEffectFunction);
            }
        };
        // 数据更新 trigger
        var trigger = function(key, newValue, oldValue) {
            // 元素更新
            var relatedEffectFnSet = dataEffectFnMap.get(key);
            if (relatedEffectFnSet) {
                var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
                try {
                    for(var _iterator = relatedEffectFnSet[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
                        var fn = _step.value;
                        fn();
                    }
                } catch (err) {
                    _didIteratorError = true;
                    _iteratorError = err;
                } finally{
                    try {
                        if (!_iteratorNormalCompletion && _iterator.return != null) {
                            _iterator.return();
                        }
                    } finally{
                        if (_didIteratorError) {
                            throw _iteratorError;
                        }
                    }
                }
            }
            // watch
            if (_this.watch[key]) {
                _this.watch[key](newValue, oldValue);
            }
        };
        var initDataProxy = function(一级父对象在data中的key, 存放数据的对象 // 数据 存在的上一层； a: { b: 1 }， 为 a
        ) {
            var data;
            if (Array.isArray(存放数据的对象)) {
                data = new Array(存放数据的对象.length);
            } else if ((typeof 存放数据的对象 === "undefined" ? "undefined" : _type_of(存放数据的对象)) === "object") {
                data = {};
            } else {
                throw new Error("父对象类型错误");
            }
            var getDataProxy = function(一级父对象在data中的key, 被代理对象) {
                if (!被代理对象) {
                    throw new Error("被代理对象不能为空值");
                }
                var proxy = new Proxy(被代理对象, {
                    deleteProperty: function deleteProperty(target, prop) {
                        var oldValue = Reflect.get(target, prop);
                        Reflect.deleteProperty(target, prop);
                        // 触发所有依赖该数据的函数
                        var keyName = 一级父对象在data中的key === undefined ? prop : 一级父对象在data中的key;
                        trigger(keyName, undefined, oldValue);
                        return true;
                    },
                    get: function get(target, prop, receiver) {
                        // 组件 render 时候会 get 数据从而触发
                        // 追踪数据变化，为数据绑定相关 effect 函数
                        var keyName = 一级父对象在data中的key === undefined ? prop : 一级父对象在data中的key;
                        track(keyName);
                        if (prop === "__raw__") {
                            return target;
                        }
                        return Reflect.get(target, prop, receiver);
                    },
                    set: function set(target, prop, newValue, receiver) {
                        var oldValue = Reflect.get(target, prop, receiver);
                        if (oldValue === newValue) {
                            return true;
                        }
                        var keyName = 一级父对象在data中的key === undefined ? prop : 一级父对象在data中的key;
                        if ((typeof newValue === "undefined" ? "undefined" : _type_of(newValue)) === "object" || Array.isArray(newValue)) {
                            var newProxy = initDataProxy(keyName, newValue);
                            Reflect.set(target, prop, newProxy, receiver);
                        } else {
                            Reflect.set(target, prop, newValue, receiver);
                        }
                        if (that.effectLog) {
                            console.log("[".concat(prop.toString(), "]set"), oldValue, "=>", Reflect.get(target, prop, receiver));
                        }
                        // 触发更新
                        trigger(keyName, newValue, oldValue);
                        return true;
                    }
                });
                // if (Array.isArray(被代理对象)) {
                //     proxy[Symbol.iterator] = function* () {
                //         for (let i = 0; i < Object.keys(proxy).length; i++) {
                //             yield proxy[i];
                //         }
                //     };
                // }
                return proxy;
            };
            var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
            try {
                // key 可能为 index
                for(var _iterator = Object.entries(存放数据的对象)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
                    var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
                    if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" || Array.isArray(value)) {
                        var keyName = 一级父对象在data中的key === undefined ? key.toString() : 一级父对象在data中的key;
                        data[key] = initDataProxy(keyName, value);
                    } else {
                        data[key] = value;
                    }
                }
            } catch (err) {
                _didIteratorError = true;
                _iteratorError = err;
            } finally{
                try {
                    if (!_iteratorNormalCompletion && _iterator.return != null) {
                        _iterator.return();
                    }
                } finally{
                    if (_didIteratorError) {
                        throw _iteratorError;
                    }
                }
            }
            return getDataProxy(一级父对象在data中的key, data);
        };
        if (option.data) {
            this.data = initDataProxy(undefined, option.data);
        } else {
            this.data = initDataProxy(undefined, {});
        }
        // 内置指令
        // 添加 e-show 指令
        var updateElementEShow = function(element, property) {
            if (property.calculatedValue) {
                element.style.display = "";
            } else {
                element.style.display = "none";
            }
        };
        _core_compiler__WEBPACK_IMPORTED_MODULE_0__["default"].registerDirective({
            name: "show",
            calculatedValue: true
        }, {
            mounted: function mounted(element, property) {
                updateElementEShow(element, property);
            },
            updated: function updated(element, property) {
                updateElementEShow(element, property);
            }
        });
        // 添加 e-bind: 和 :（冒号） 指令
        var updateElementEBing = function(element, property) {
            var arrtibuteName = property.name.split(":")[1];
            if (!arrtibuteName) {
                return;
            }
            if (property.calculatedValue === undefined || property.calculatedValue === null) {
                return;
            }
            element.setAttribute(arrtibuteName, property.calculatedValue.toString());
        };
        _core_compiler__WEBPACK_IMPORTED_MODULE_0__["default"].registerDirective({
            name: "bind",
            aliasName: ":",
            calculatedValue: true
        }, {
            mounted: function mounted(element, property) {
                updateElementEBing(element, property);
            },
            updated: function updated(element, property) {
                updateElementEBing(element, property);
            }
        });
        // 添加 e-model 指令
        var eMOdelAttributeObserver = new MutationObserver(function(records) {
            var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
            try {
                for(var _iterator = records[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
                    var r = _step.value;
                    // console.log(r);
                    var element = r.target;
                    // 查看属性是否有 e-model
                    var 指令属性名 = "e-model:" + r.attributeName;
                    var 数据内容 = element.getAttribute(指令属性名);
                    if (!数据内容) {
                        continue;
                    }
                    try {
                        var newValue = element.getAttribute(r.attributeName);
                        new Function("newValue", "(this.data.".concat(数据内容, ") = newValue;")).bind(_this)(newValue);
                    } catch (e) {
                        console.error(element, 指令属性名, "错误的值");
                    }
                }
            } catch (err) {
                _didIteratorError = true;
                _iteratorError = err;
            } finally{
                try {
                    if (!_iteratorNormalCompletion && _iterator.return != null) {
                        _iterator.return();
                    }
                } finally{
                    if (_didIteratorError) {
                        throw _iteratorError;
                    }
                }
            }
        });
        _core_compiler__WEBPACK_IMPORTED_MODULE_0__["default"].registerDirective({
            name: "model",
            calculatedValue: true
        }, {
            mounted: function mounted(element, property) {
                // 做数据绑定
                var 被绑定的属性的名字 = property.name.split(":")[1];
                if (!被绑定的属性的名字) {
                    // 无有绑定属性
                    return;
                }
                // 修改属性值
                element.setAttribute(被绑定的属性的名字, property.calculatedValue);
                // 监听属性
                eMOdelAttributeObserver.observe(element, {
                    attributes: true
                });
                var 修改data的值 = element[被绑定的属性的名字] !== undefined ? function() {
                    var newValue = element[被绑定的属性的名字];
                    new Function("newValue", "(this.data.".concat(property.value, ") = newValue;")).bind(that)(newValue);
                } : function() {};
                element.addEventListener("change", 修改data的值);
                element.addEventListener("input", 修改data的值);
            },
            updated: function updated(element, property) {
                var 被绑定的属性的名字 = property.name.split(":")[1];
                if (!被绑定的属性的名字) {
                    return;
                }
                element.setAttribute(被绑定的属性的名字, property.calculatedValue);
            }
        });
        // 添加 e-on: 和 @ 指令
        _core_compiler__WEBPACK_IMPORTED_MODULE_0__["default"].registerDirective({
            name: "on",
            aliasName: "@"
        }, {
            mounted: function mounted(element, property) {
                var eventName = property.name.split(":")[1];
                if (!eventName) {
                    eventName = property.name.split("@")[1];
                }
                if (!eventName) {
                    return;
                }
                var expression = property.value.trim();
                if (that.methods[expression]) {
                    element.addEventListener(eventName, function(e) {
                        that.methods[expression](e);
                    });
                } else {
                    throw new Error("暂时只支持使用 methods 中的函数");
                }
            }
        });
        // 挂载
        if (option.elementSelector) {
            this.mount(option.elementSelector);
        }
    }
    _create_class(EUV, [
        {
            key: "getValuesByName",
            value: function getValuesByName(argNames) {
                var _this = this;
                // 使用 标识符 从 data computed methods 中取值
                // 用于 运行 html 中的表达式
                var args = new Array(argNames.length);
                argNames.forEach(function(name, index) {
                    var dataValue = _this.data[name];
                    if (dataValue !== undefined) {
                        args[index] = dataValue;
                    } else if (_this.computed[name]) {
                        args[index] = _this.computed[name].bind(_this)();
                    } else if (_this.methods[name]) {
                        var _this_methods_name;
                        args[index] = (_this_methods_name = _this.methods[name]) === null || _this_methods_name === void 0 ? void 0 : _this_methods_name.bind(_this)();
                    } else {
                        args[index] = window[name];
                    }
                });
                return args;
            }
        },
        {
            key: "initEUVNodeChildrenRef",
            value: function initEUVNodeChildrenRef(node) {
                var _this = this;
                // 初始化 domElement ref
                var createDOMElementRef = function(node) {
                    var refName = node.props["ref"];
                    if (!refName) {
                        return null;
                    }
                    if (!node.element) {
                        return;
                    }
                    _this.$refs[refName] = new Proxy(node.element, {
                        get: function(target, prop) {
                            return target[prop];
                        },
                        set: function(target, prop, value) {
                            target[prop] = value;
                            // 判断是否更新某属性
                            var attributeValue = target.getAttribute(prop);
                            if (attributeValue !== undefined && attributeValue !== null) {
                                // 更新属性是否 e-model
                                var attributeName = "e-model:" + prop;
                                var 绑定的数据内容 = target.getAttribute(attributeName);
                                if (绑定的数据内容) {
                                    target.setAttribute(prop, value);
                                }
                            }
                            return true;
                        }
                    });
                };
                var initChildrenDOMElementRef = function(node) {
                    if (!node.children) {
                        return;
                    }
                    var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
                    try {
                        for(var _iterator = node.children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
                            var child = _step.value;
                            initChildrenDOMElementRef(child);
                            createDOMElementRef(child);
                        }
                    } catch (err) {
                        _didIteratorError = true;
                        _iteratorError = err;
                    } finally{
                        try {
                            if (!_iteratorNormalCompletion && _iterator.return != null) {
                                _iterator.return();
                            }
                        } finally{
                            if (_didIteratorError) {
                                throw _iteratorError;
                            }
                        }
                    }
                };
                initChildrenDOMElementRef(node);
                createDOMElementRef(node);
            }
        },
        {
            /**
   * 挂载 EUV APP
   * @param { string } elementSelector
   * @returns
   */ key: "mount",
            value: function mount(elementSelector) {
                var _this = this;
                if (!elementSelector || typeof elementSelector !== "string") {
                    return;
                }
                /**
     * @type { HTMLElement }
     */ this.mountedElement = document.querySelector(elementSelector);
                if (!this.mountedElement) {
                    throw new Error("elementSelector is not valid");
                }
                this.mountedElement.setAttribute("data-e-app", "");
                // 初始化元素
                this.appNode = _core_compiler__WEBPACK_IMPORTED_MODULE_0__["default"].compileDOMElement(this.mountedElement);
                if (!this.appNode) {
                    throw new Error("未知错误");
                }
                _core_compiler__WEBPACK_IMPORTED_MODULE_0__["default"].compileEUVNode(this.appNode, this.mountedElement, function(needArgs) {
                    return _this.getValuesByName(needArgs);
                });
                // this.mountedElement.innerHTML = "";
                // 渲染DOM元素
                var renderNode = function(node) {
                    if (node.children) {
                        var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
                        try {
                            for(var _iterator = node.children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
                                var child = _step.value;
                                renderNode(child);
                            }
                        } catch (err) {
                            _didIteratorError = true;
                            _iteratorError = err;
                        } finally{
                            try {
                                if (!_iteratorNormalCompletion && _iterator.return != null) {
                                    _iterator.return();
                                }
                            } finally{
                                if (_didIteratorError) {
                                    throw _iteratorError;
                                }
                            }
                        }
                    }
                    if (!node.render) {
                        return;
                    }
                    activeEffectFunction = node.render;
                    node.render();
                    activeEffectFunction = null;
                };
                renderNode(this.appNode);
                this.initEUVNodeChildrenRef(this.appNode);
                this.init = true;
                // 完成 mounted 动作
                if (this.mounted) this.mounted.bind(this)();
            }
        }
    ]);
    return EUV;
}();


/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/define property getters */
/******/ 	(() => {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = (exports, definition) => {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!**********************!*\
  !*** ./src/index.ts ***!
  \**********************/
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   EUV: () => (/* reexport safe */ _euv__WEBPACK_IMPORTED_MODULE_0__.EUV),
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _euv__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./euv */ "./src/euv.ts");


/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_euv__WEBPACK_IMPORTED_MODULE_0__.EUV);

})();

/******/ 	return __webpack_exports__;
/******/ })()
;
});